package wiki.hitime.stl.daq.enums;


import wiki.hitime.stl.daq.bean.base.NameValue;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum DataAcquisitionTypeEnum {

    // 数据源类型枚举
    SINGLE_VALUE_DATA(1, "单一值采集"),
    SINGLE_COLUMN_DATA(2, "单列值采集");


    private int status;
    private String msg;

    DataAcquisitionTypeEnum(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public int getStatus() {
        return this.status;
    }

    public String getMsg() {
        return this.msg;
    }

    public static DataAcquisitionTypeEnum valueOf(int status) {
        for (DataAcquisitionTypeEnum enumItem : DataAcquisitionTypeEnum.values()) {
            if (enumItem.getStatus() == status) {
                return enumItem;
            }
        }
        return null;
    }

    public static List<NameValue> getList() {
        return Arrays.stream(DataAcquisitionTypeEnum.values()).map(item -> new NameValue(item.getMsg(), item.getStatus())).collect(Collectors.toList());
    }
}
